<template>
  <div>
    <Header contentTitle="活动风采"></Header>
    <div class="home-actList-wrapper">
      <scroller :on-infinite="handleReachButton">
        <div class="home-actList">
          <div class="list-wrapper">
            <div
              class="act-box"
              v-for="i in getActivityData"
              :key="i.id"
              :style="'background:url('+i.cover+') no-repeat;background-size:100%'"
              @click="$router.push({ path: i.id+''})"
            >
              <span class="bgsp"></span>
              <span class="titlesp">{{i.title}}</span>
            </div>
          </div>
        </div>
      </scroller>
    </div>
  </div>
</template> 

<script>
import Header from "~/components/topHeader";
import { getResearchActivityByPage } from "~/api/identity";
import ls from "store2";
export default {
  components: {
    Header
  },
  data() {
    return {
      productList: [],
      currentPage: 1,
      getActivityData: []
    };
  },
  mounted() {
    this.$visit("sxPracticeList")
    this.getALlActivityList();
  },
  methods: {
   
    getALlActivityList() {
       this.$loading('open');
      getResearchActivityByPage({
          pageNo: 1,
          pageSize: 10
        })
        .then(res => {
          this.getActivityData = res.data.list;
          this.totalPages = res.data.pages;
          this.$hideLoading();
        })
        .catch(error => { this.$hideLoading();});
    },
    handleReachButton(done) {
      if (this.currentPage < this.totalPages) {
        this.currentPage = this.currentPage + 1;
        getResearchActivityByPage({
            pageNo: this.currentPage,
            pageSize: 10
          })
          .then(res => {
            let newArr = res.data.list;
            this.getActivityData = this.getActivityData.concat(newArr);
            this.totalPages = res.data.pages;
            // this.$nextTick(() => {

            // });

            done();
          });
      } else {
        done(true);
        return;
      }
    }
  }
};
</script>

<style scoped lang="less">
.home-actList-wrapper {
  width: 100%;
  height: 100vh;
  margin-top: -0.88rem;
  background: #fff;
}
.home-actList {
  width: 100%;
  height: auto;
  background: #fff;
  padding-top: 0.88rem;
  box-sizing: border-box;
}
.list-wrapper {
  padding: 0.3rem;
  box-sizing: border-box;
  .act-box {
    width: 100%;
    height: 3.86rem;
    border-radius: 0.1rem;
  
    position: relative;
    margin-bottom: 0.3rem;
  
    span {
      position: absolute;
      width: 100%;
      height: 1rem;
      box-sizing: border-box;
      left: 0;
      bottom: 0rem;
      padding: 0.1rem 0.2rem;
      border-bottom-left-radius: 0.1rem;
      border-bottom-right-radius: 0.1rem;
    }
    .bgsp {
      background: rgba(0, 0, 0, 0.3);
    
    }
    .titlesp {
      font-size: 0.3rem;
      font-family: PingFangSC;
      font-weight: 600;
      //   height: 0.8rem;
   
      color: rgba(255, 255, 255, 1);
      //   line-height: 0.4rem;

      
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      display: flex;
      display: -webkit-flex;
      justify-content: left; /*水平居中*/
      align-items: center; /*垂直居中*/
      -webkit-align-items: center;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }
}
</style>
